# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-bitstring
pkgname=('python2-bitstring' 'python-bitstring')
_pkgname=bitstring
pkgver=4.3.1
pkgrel=1
pkgdesc='Simple construction, analysis and modification of binary data.'
arch=('any')
url='https://pypi.org/project/bitstring/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools' 'unzip')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('5c36d37eb447632c95559788187ea40436fb327a6fab72c6c7332a11726172a1ac9f9ea115022ed2bab644152f04e73541efd838a057890763a2dba78d1dc4ab')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-bitstring() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-bitstring() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

